﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace WMM.Tapioca.Formula.Aspects
{
    /// <summary>
    /// An empty OCC rule is an OCC rule that is expressed by the <formula:occEmpty> element. 
    /// </summary>
    public class OccEmptyAspect : OccAspect
    {
        /// <summary>
        /// Constructor.
        /// </summary>
        public OccEmptyAspect(XElement occEmptyAspect)
        {
            XElement aspect = occEmptyAspect.Parent;

            if (aspect.Attribute("source") != null)
            {
                this.Source = aspect.Attribute("source").Value;
            }

            if (occEmptyAspect.Attribute("source") != null)
            {
                this.Source = occEmptyAspect.Attribute("source").Value;
            }

            XAttribute occ = occEmptyAspect.Attribute("occ");

            if (occ != null)
            {
                this.Occ = occ.Value;
            }
        }
    }
}
